package com.wantong.jianpu.adapters;

import android.widget.ImageView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.lxj.xpopup.XPopup;
import com.lxj.xpopup.util.SmartGlideImageLoader;
import com.wantong.jianpu.R;
import com.wantong.jianpu.beans.InspectionDetailBean;
import com.wantong.jianpu.utils.ImageUtils;

/**
 * @author PACY
 * @date 2022/4/25
 * description:
 */
public class TourDetailImageAdapter extends BaseQuickAdapter<InspectionDetailBean.RecordListDTO.ImageListDTO, BaseViewHolder> {
    ImageView imageView;
    public TourDetailImageAdapter() {
        super(R.layout.detail_image_item_view);
    }

    @Override
    protected void convert(BaseViewHolder holder, InspectionDetailBean.RecordListDTO.ImageListDTO s) {
        imageView = holder.getView(R.id.image_iv);
        ImageUtils.loadImage(s.getUrl(),imageView);

        imageView.setOnClickListener(v -> {
            new XPopup.Builder(getContext()).asImageViewer(imageView, s.getUrl(), new SmartGlideImageLoader()).show();
        });

    }
}
